package org.libl.service.admin.impl;
import org.libl.dao.admin.impl.AdminDaoImpl;
import org.libl.domain.Admin;
import org.libl.service.admin.AdminService;
import org.libl.dao.admin.AdminDao;
/**
 * 管理员模块sercice层的业务实现类
 */
public class AdminServiceImpl implements AdminService {
    //1.创建dao层对象
    private AdminDao dao = new AdminDaoImpl();
    public Admin login(String username, String password){
        return dao.findByNameAndPassword(username,password);
    }

    public boolean registerAdmin(Admin adminForm){
        int row =  dao.addAdmin(adminForm);
        if(row>0){
            return true;
        }else{
            return false;
        }
    }
    public boolean checkCountExist(String count){
        Admin  admin = dao.findAdminByCount(count);
        if(admin!=null){
            return  true;//根据账号查询到管理员信息,表示之前已经注册过了
        }else {
            return false;
        }

    }
}
